package com.xbjtech.util;

import java.util.Random;

import org.apache.shiro.crypto.hash.SimpleHash;
import org.apache.shiro.util.ByteSource;

public class StringUtils {
	
	public static String randomString(int length) {
		Random r = new Random();
		char[] chars = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
		StringBuffer sb = new StringBuffer();
		for (int i = 0; i < length; i++) {
			char c = chars[r.nextInt(chars.length)];
			sb.append(c);
		}
		return sb.toString();
	}
	
	public static void main(String[] args) {
		SimpleHash simpleHash = new SimpleHash("MD5", "123456", ByteSource.Util.bytes("1"), 1);
		System.out.println(simpleHash);
	}

}
